package com.ymatou.iapi.productquery.testcase;

import com.ymatou.iapi.prodstock.parameter.AuditProductActivityStockBean;
import com.ymatou.iapi.productmanager.parameter.SaveGrouponBean;
import com.ymatou.iapi.productmanager.parameter.product.AddSellerProductRequest;
import com.ymatou.iapi.productquery.parameter.ApplyActivityDto;
import com.ymatou.iapi.productquery.parameter.ProductDetail.CatalogInDetailBean;
import com.ymatou.iapi.productquery.parameter.ProductDetail.ProductInDetailBean;
import com.ymatou.iapi.productquery.service.GetProductInfoByProductIdCall;
import com.ymatou.iapi.productquery.service.GetProductInfoByTradeIsolationCall;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.*;
import com.ymttest.database.model.GrouponProducts;
import com.ymttest.database.model.LiveRoom;
import com.ymttest.database.model.YmtCatalogsI;
import com.ymttest.database.model.YmtProductActivityStock;
import com.ymttest.database.mongo.jproduct.ActivityProductsWapper;
import com.ymttest.database.mongo.jproduct.ProductTimeStampWapper;
import com.ymttest.database.mongo.jproduct.ProductsWapperV2;
import com.ymttest.database.sqlwapper.YmtCatalogsIWapper;
import com.ymttest.database.sqlwapper.YmtProductActivityStockWapper;
import com.ymttest.database.sqlwapper.YmtProductsIWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.MapUtil;
import com.ymttest.utils.YMTDateUtil;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.*;
import org.junit.experimental.categories.Category;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

public class Ts_GetProductInfoByProductIdV2 {

    private static GetProductInfoByProductIdCall getProductInfoByProductIdCall = new GetProductInfoByProductIdCall();
    private static ProductPriceCallService priceCallService = new ProductPriceCallService();
    private static Integer sellerId = Integer.valueOf(EnvSetup.getData("productpriceSellerId"));
    private static ProductTimeStampWapper productTimeStampWapper = new ProductTimeStampWapper();
    private static GetProductInfoByTradeIsolationCall getProductInfoByTradeIsolationCall = new GetProductInfoByTradeIsolationCall();

//    /**
//     * 优选
//     */
//
//    private static Integer sellerId2 = 3383;
//    //渠道商
//    private static int rootUserId = AgentUsers.rootUserId;
//    private static String rootUserName = "NickautoTest";
//    //渠道商->代理商1
//    private static int agentUserId1 = AgentUsers.agentUserId1;
//    private static String agentUserName1 = "NickautoTest";
//    //渠道商->代理商2
//    private static int agentUserId2 = AgentUsers.agentUserId2;
//    private static String agentUserName2 = "NickautoTest";
//
//    //vip渠道
//    private static int vipRootUserId = AgentUsers.vipRootUserId;
//    private static String vipRootUserName = "NickautoTest";
//    //vip渠道->代理
//    private static int vipAgentUserId1 = AgentUsers.vipAgentUserId1;
//    private static String vipAgentUserName1 = "dgsq408897016";
//    //vip渠道->代理->代理
//    private static int vipAgentUserId2 = AgentUsers.vipAgentUserId2;
//    private static String vipAgentUserName2 = "NickautoTest";
    @BeforeClass
    public static void setUp() {
        Logger.createResultFile("非交易隔离查询接口,获取商品单品详细信息");
//        try {
//			//GodfreightmgrService.deleteBySellerId(rootUserId);
//		} catch (IOException e) {
//			e.printStackTrace();
//		}
    }

    @Before
    public void caseUp() {

    }

    @AfterClass
    public static void tearDown() {
        Logger.generateResult(getProductInfoByProductIdCall.getOpurl());
    }

    @After
    public void caseDown() {
        Logger.end();
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_001() {
        Logger.start(true,"单活动，获取商品详情");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            //获取规格ID
            List<String> catalogs = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
            //创建一个高优先级活动  得到活动id
            Integer activityId = ProductManagerCallServiceV2.createNoIsolationActivityInProcess();
            //报名活动  获得商品在活动中的id
            String price1 = "8.0";
            Integer activityStockNum = 100;
            List<String> aids = ProductManagerCallServiceV2.ApplyActivity(productId, sellerId,catalogs,activityId, activityStockNum,price1);
            //审核通过
            ProductManagerCallServiceV2.approveProductInActivityV2(productId,aids.get(0),true);
            new ProductsWapperV2().updateActivityProductByProductId(MapUtil.hashMap("aid",activityId),MapUtil.hashMap("start",
                    YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600)),"end",YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600))));
            //更新商品时间戳
            productTimeStampWapper.update(productId, MapUtil.hashMap("aut",new Date(),"cut",new Date()));
            getProductInfoByProductIdCall.callAndGetReturnData(productId);

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<catalogs.size();i++){
                if(catalogs.get(i).equals(cataloglist.get(i).getCatalogId())){
                    Logger.verifyEquals(activityStockNum,cataloglist.get(i).getActivityStock(),"验证活动库存");
                    Logger.verifyEquals(Double.valueOf(price1),cataloglist.get(i).getActivityPrice(),"验证活动价格");
                }
            }
            Logger.verifyEquals(1,product.getProductActivity().getActivityLevel(),"验证活动优先级");
            Logger.verifyEquals(activityId,product.getProductActivity().getActivityId(),"验证activityId");
            Logger.verifyEquals(Integer.parseInt(aids.get(0)),product.getProductActivity().getProductInActivityId(),"ProductInActivityId");
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_0101() {
        Logger.start(true,"单活动，获取商品详情,部分规格卖完，卖完的规格显示原价");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "8";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            ApplyActivityDto applyActivityDto = priceCallService.ApplyHighActivity(price1,productId,beginTime1,endTime1);
            JSONArray catalogsAry = priceCallService.GetCatalogs(Integer.parseInt(applyActivityDto.getAids().get(0)));
            priceCallService.updateCatalogStockInMgo(Integer.parseInt(applyActivityDto.getAids().get(0)),catalogsAry);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<applyActivityDto.getCatalogs().size();i++){
                if(applyActivityDto.getCatalogs().get(i).equals(cataloglist.get(i).getCatalogId())){
                   // Logger.verifyEquals(applyActivityDto.getActivityStockNum(),cataloglist.get(i).getActivityStock(),"验证活动库存");
                    Logger.verifyEquals(Double.valueOf(price1),cataloglist.get(i).getActivityPrice(),"验证活动价格");
                }
            }
            Logger.verifyEquals(1,product.getProductActivity().getActivityLevel(),"验证活动优先级");
            Logger.verifyEquals(applyActivityDto.getActivityId(),product.getProductActivity().getActivityId(),"验证activityId");
            Logger.verifyEquals(Integer.parseInt(applyActivityDto.getAids().get(0)),product.getProductActivity().getProductInActivityId(),"ProductInActivityId");
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_0102() {
        Logger.start(true,"单活动，获取商品详情,规格库存全部卖完");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "8";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            //新增同步 by wuwen 20210119
            ProductManagerCallServiceV3.productMongocrudSync(productId,null,0);
            ApplyActivityDto applyActivityDto = priceCallService.ApplyHighActivity(price1,productId,beginTime1,endTime1);
            ActivityProductsWapper activityProductsWapper = new ActivityProductsWapper();
            int inaid = Integer.parseInt(activityProductsWapper.getByProdId(productId).get("inaid").toString());
            priceCallService.updateActivityStockTo0InMgo(inaid);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<applyActivityDto.getCatalogs().size();i++){
                if(applyActivityDto.getCatalogs().get(i).equals(cataloglist.get(i).getCatalogId())){
                    // Logger.verifyEquals(applyActivityDto.getActivityStockNum(),cataloglist.get(i).getActivityStock(),"验证活动库存");
                    //update by wuwen 库存为0 20210119
                    Logger.verifyEquals(0,cataloglist.get(i).getActivityStock(),"验证活动库存");
                   // Logger.verifyEquals(Double.valueOf(price1),cataloglist.get(i).getActivityPrice(),"验证活动价格");
                }
            }
            Logger.verifyEquals(1,product.getSellOutActivity().getActivityLevel(),"验证活动优先级");
            Logger.verifyEquals(applyActivityDto.getActivityId(),product.getSellOutActivity().getActivityId(),"验证activityId");
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_0010() {
        Logger.start(true,"多优先级活动同时，获取商品详情");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "8.0";
            String price2 = "8.0";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price1,productId,beginTime1,endTime1);
            priceCallService.ApplyLowActivity(price2,productId,beginTime1,endTime1);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<applyActivityDto1.getCatalogs().size();i++){
                if(applyActivityDto1.getCatalogs().get(i).equals(cataloglist.get(i).getCatalogId())){
                    Logger.verifyEquals(applyActivityDto1.getActivityStockNum(),cataloglist.get(i).getActivityStock(),"验证活动库存");
                    Logger.verifyEquals(Double.valueOf(price1),cataloglist.get(i).getActivityPrice(),"验证活动价格");
                }
            }
            Logger.verifyEquals(1,product.getProductActivity().getActivityLevel(),"验证活动优先级");
            Logger.verifyEquals(applyActivityDto1.getActivityId(),product.getProductActivity().getActivityId(),"验证activityId");
            Logger.verifyEquals(Integer.parseInt(applyActivityDto1.getAids().get(0)),product.getProductActivity().getProductInActivityId(),"ProductInActivityId");
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_002() {
        Logger.start(true,"多优先级活动同时进行，高优先级活动库存规格全部卖完,露出低优先级活动价格");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "8.0";
            String price2 = "9.0";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price1,productId,beginTime1,endTime1);
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price2,productId,beginTime1,endTime1);
            priceCallService.updateActivityStockTo0InMgo(Integer.parseInt(applyActivityDto1.getAids().get(0)));
            getProductInfoByProductIdCall.callAndGetReturnData(productId);
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<applyActivityDto2.getCatalogs().size();i++){
                if(applyActivityDto2.getCatalogs().get(i).equals(cataloglist.get(i).getCatalogId())){
                    Logger.verifyEquals(applyActivityDto2.getActivityStockNum(),cataloglist.get(i).getActivityStock(),"验证活动库存");
                    Logger.verifyEquals(Double.valueOf(price2),cataloglist.get(i).getActivityPrice(),"验证活动价格");
                }
            }
            Logger.verifyEquals(0,product.getProductActivity().getActivityLevel(),"验证活动优先级");
            Logger.verifyEquals(applyActivityDto2.getActivityId(),product.getProductActivity().getActivityId(),"验证activityId");
            Logger.verifyEquals(Integer.parseInt(applyActivityDto2.getAids().get(0)),product.getProductActivity().getProductInActivityId(),"ProductInActivityId");
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_0011() {
        Logger.start(true,"多优先级活动同时进行，高优先级活动库存部分规格卖完，卖完规格不显示低活动价");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "8.0";
            String price2 = "9.0";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price1,productId,beginTime1,endTime1);
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price2,productId,beginTime1,endTime1);
            JSONArray catalogsAry = priceCallService.GetCatalogs(Integer.parseInt(applyActivityDto1.getAids().get(0)));
            priceCallService.updateCatalogStockInMgo(Integer.parseInt(applyActivityDto1.getAids().get(0)),catalogsAry);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<applyActivityDto1.getCatalogs().size();i++){
                if(cataloglist.get(i).getActivityStock() == 0){
                    Logger.verifyEquals(Double.valueOf(price1),cataloglist.get(i).getActivityPrice(),"验证活动价格");
                }
            }
            //验证当前活动信息
            Logger.verifyEquals(1,product.getProductActivity().getActivityLevel(),"验证活动优先级");
            Logger.verifyEquals(applyActivityDto1.getActivityId(),product.getProductActivity().getActivityId(),"验证activityId");
            Logger.verifyEquals(Integer.parseInt(applyActivityDto1.getAids().get(0)),product.getProductActivity().getProductInActivityId(),"ProductInActivityId");

        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_0013() {
        Logger.start(true,"多优先级活动同时进行，高优先级活动和低优先级库存都卖完,显示原价,露出售罄活动");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            Double price = 0.0;
            String price1 = "8.0";
            String price2 = "9.0";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price1,productId,beginTime1,endTime1);
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime1,endTime1);
            priceCallService.updateActivityStockTo0InMgo(Integer.parseInt(applyActivityDto1.getAids().get(0)));
            priceCallService.updateActivityStockTo0InMgo(Integer.parseInt(applyActivityDto2.getAids().get(0)));
            getProductInfoByProductIdCall.callAndGetReturnData(productId);
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<applyActivityDto1.getCatalogs().size();i++){
                Logger.verifyEquals(0,cataloglist.get(i).getActivityStock(),"验证活动库存");
                Logger.verifyEquals(price,cataloglist.get(i).getActivityPrice(),"验证活动价格");
            }
            //验证当前活动信息
            Logger.verifyEquals(null,product.getProductActivity(),"验证当前活动活动");
            //验证售罄活动信息
            Logger.verifyEquals(applyActivityDto2.getActivityId(),product.getSellOutActivity().getActivityId(),"验证售罄活动id");

        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_0012() {
        Logger.start(true,"多优先级活动不在同一时间进行，低优先级活动先开始，高优先级活动未开始，时间有重合");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "8.0";
            String price2 = "9.0";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*2));

            Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*2));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price1,productId,beginTime2,endTime2);
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price2,productId,beginTime1,endTime1);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<applyActivityDto1.getCatalogs().size();i++){
                Logger.verifyEquals(applyActivityDto2.getActivityStockNum(),cataloglist.get(i).getActivityStock(),"验证活动库存");
                Logger.verifyEquals(Double.valueOf(price2),cataloglist.get(i).getActivityPrice(),"验证活动价格");
            }
            //验证当前活动信息
            Logger.verifyEquals(0,product.getProductActivity().getActivityLevel(),"验证活动优先级");
            Logger.verifyEquals(applyActivityDto2.getActivityId(),product.getProductActivity().getActivityId(),"验证activityId");
            Logger.verifyEquals(Integer.parseInt(applyActivityDto2.getAids().get(0)),product.getProductActivity().getProductInActivityId(),"ProductInActivityId");

        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_003() {
        Logger.start(true,"下一场活动");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "9.0";
            Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*2));
            ApplyActivityDto applyActivityDto = priceCallService.ApplyHighActivity(price1,productId,beginTime2,endTime2);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<applyActivityDto.getCatalogs().size();i++){
                Logger.verifyEquals(applyActivityDto.getActivityStockNum(),cataloglist.get(i).getNextActivityStock(),"验证下一场活动库存");
                Logger.verifyEquals(Double.valueOf(price1),cataloglist.get(i).getNextActivityPrice(),"验证下一场活动价格");
            }
            //验证下一场活动信息
            Logger.verifyEquals(1,product.getNextActivity().getActivityLevel(),"验证下一场活动优先级");
            Logger.verifyEquals(applyActivityDto.getActivityId(),product.getNextActivity().getActivityId(),"验证下一场activityId");
            Logger.verifyEquals(Integer.parseInt(applyActivityDto.getAids().get(0)),product.getNextActivity().getProductInActivityId(),"验证下一场ProductInActivityId");

        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_103() {
        Logger.start(true,"下一场活动，报名多个优先级活动");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "9.0";
            String price2 = "8.0";
            Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*2));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price2,productId,beginTime2,endTime2);
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime2,endTime2);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<applyActivityDto1.getCatalogs().size();i++){
                Logger.verifyEquals(applyActivityDto1.getActivityStockNum(),cataloglist.get(i).getNextActivityStock(),"验证下一场活动库存");
                Logger.verifyEquals(Double.valueOf(price2),cataloglist.get(i).getNextActivityPrice(),"验证下一场活动价格");
            }
            //验证下一场活动信息
            Logger.verifyEquals(1,product.getNextActivity().getActivityLevel(),"验证下一场活动优先级");
            Logger.verifyEquals(applyActivityDto1.getActivityId(),product.getNextActivity().getActivityId(),"验证下一场activityId");
            Logger.verifyEquals(Integer.parseInt(applyActivityDto1.getAids().get(0)),product.getNextActivity().getProductInActivityId(),"验证下一场ProductInActivityId");

        }catch(Exception e){
            Logger.fail(e);
        }
    }


    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_004() {
        Logger.start(true,"报名一个低优先级活动，下一场活动高优先级，时间重合");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "8.0";
            String price2 = "9.0";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*2));

            Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*2));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price1,productId,beginTime2,endTime2);
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price2,productId,beginTime1,endTime1);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<cataloglist.size();i++){
                Logger.verifyEquals(applyActivityDto2.getActivityStockNum(),cataloglist.get(i).getActivityStock(),"验证当前活动库存");
                Logger.verifyEquals(Double.valueOf(price2),cataloglist.get(i).getActivityPrice(),"验证当前活动价格");
                Logger.verifyEquals(applyActivityDto1.getActivityStockNum(),cataloglist.get(i).getNextActivityStock(),"验证下一场活动库存");
                Logger.verifyEquals(Double.valueOf(price1),cataloglist.get(i).getNextActivityPrice(),"验证下一场活动价格");
            }
            //验证下一场活动信息
            Logger.verifyEquals(1,product.getNextActivity().getActivityLevel(),"验证下一场活动优先级");
            Logger.verifyEquals(applyActivityDto1.getActivityId(),product.getNextActivity().getActivityId(),"验证下一场activityId");
            Logger.verifyEquals(Integer.parseInt(applyActivityDto1.getAids().get(0)),product.getNextActivity().getProductInActivityId(),"验证下一场ProductInActivityId");

        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_010() {
        Logger.start(true,"报名一个低优先级活动一个高优先级活动，下一场活动高优先级，低优先级活动还没结束(开发待排查)");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "8.0";
            String price2 = "9.0";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*4));

            Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price1,productId,beginTime2,endTime2);
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price2,productId,beginTime1,endTime1);

            Date beginTime3 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*2));
            Date endTime3 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*4));
            Integer activityId = priceCallService.getProdPriceWithActivityInFuture(sellerId,productId, MapUtil.hashMap("ActivityTemplateId", 2),beginTime3,endTime3,1,false);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<cataloglist.size();i++){
                Logger.verifyEquals(applyActivityDto1.getActivityStockNum(),cataloglist.get(i).getActivityStock(),"验证当前活动库存");
                Logger.verifyEquals(Double.valueOf(price1),cataloglist.get(i).getActivityPrice(),"验证当前活动价格");
            }
            //验证下一场活动信息
            Logger.verifyEquals(1,product.getNextActivity().getActivityLevel(),"验证下一场活动优先级");
            Logger.verifyEquals(activityId,product.getNextActivity().getActivityId(),"验证下一场activityId");

        }catch(Exception e){
            Logger.fail(e);
        }
    }


    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_006() {
        Logger.start(true,"单活动，报名高优先级活动，获取商品详情，下一场活动低优先级，时间重合，下一场活动为低优先活动，当前价格高优先价格");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String highPrice = "8.0";
            String lowPrice = "9.0";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*3));

            Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*2));
            //创建一个高优先级活动
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(highPrice,productId,beginTime1,endTime1);
            //创建一个低优先级活动
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(lowPrice,productId,beginTime2,endTime2);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<cataloglist.size();i++){
                Logger.verifyEquals(applyActivityDto1.getActivityStockNum(),cataloglist.get(i).getActivityStock(),"验证当前活动库存");
                Logger.verifyEquals(Double.valueOf(highPrice),cataloglist.get(i).getActivityPrice(),"验证当前活动价格");
                Logger.verifyEquals(applyActivityDto2.getActivityStockNum(),cataloglist.get(i).getNextActivityStock(),"验证下一场活动库存");
                Logger.verifyEquals(Double.valueOf(lowPrice),cataloglist.get(i).getNextActivityPrice(),"验证下一场活动价格");

            }
            //验证下一场活动信息
            Logger.verifyEquals(0,product.getNextActivity().getActivityLevel(),"验证下一场活动优先级");
            Logger.verifyEquals(applyActivityDto2.getActivityId(),product.getNextActivity().getActivityId(),"验证下一场activityId");
            Logger.verifyEquals(Integer.parseInt(applyActivityDto2.getAids().get(0)),product.getNextActivity().getProductInActivityId(),"验证下一场ProductInActivityId");

        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_007() {
        Logger.start(true,"多活动，同时报名高优先级活动和低优先级，获取商品详情，下一场活动高优先级，时间重合");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String highPrice = "8.0";
            String lowPrice = "9.0";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));

            Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*4));
            //报名一个高优先级活动，活动已经开始
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(highPrice,productId,beginTime2,endTime2);
            //报名一个低优先级活动，活动已经开始
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(lowPrice,productId,beginTime1,endTime1);

            //下一场活动高优先级活动，活动未开始
            Date beginTime3 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*2));
            Date endTime3 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600*4));
//            Integer activityId = priceCallService.getProdPriceWithActivityInFuture(sellerId,productId, MapUtil.hashMap("ActivityTemplateId", 2),beginTime3,endTime3,1,false);

            Integer activityId = priceCallService.getProdPriceWithActivityInFuture(sellerId,productId, MapUtil.hashMap("ActivityTemplateId", 1),beginTime3,endTime3,1,false);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            for (int i=0;i<cataloglist.size();i++){
                Logger.verifyEquals(applyActivityDto1.getActivityStockNum(),cataloglist.get(i).getActivityStock(),"验证当前活动库存");
                Logger.verifyEquals(Double.valueOf(highPrice),cataloglist.get(i).getActivityPrice(),"验证当前活动价格");
            }
            //验证下一场活动信息
            Logger.verifyEquals(1,product.getNextActivity().getActivityLevel(),"验证下一场活动优先级");
            Logger.verifyEquals(activityId,product.getNextActivity().getActivityId(),"验证下一场activityId");

        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_008() {
        Logger.start(true,"商品预售活动,非交易隔离，活动未开始，预售活动不露出");
        try {
            //活动未开始
            AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
            activityStockBean.setActivityType(2);
            activityStockBean.getFBXCatalogLockList().forEach(p->{
                p.setEarnest(10);
                p.setAction(1);
                p.setEarnestDedution(15);
            });
            ProdStockCallService.AuditProductActivityStock(activityStockBean);

            //平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
            YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
            Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
            //更新活动更新活动商品状态（预售活动）
            ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);
            new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",false));
//            checkByProductId(activityStockBean.getProductID(),0,activityStockBean.getProductActivityId(),0,false);


            getProductInfoByProductIdCall.callAndGetReturnData(activityStockBean.getProductID());
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            Logger.verifyEquals(null,product.getProductActivity(),"验证当前活动为空");
            Logger.verifyEquals(null,product.getNextActivity(),"验证下一场活动为空");
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_009() {
        Logger.start(true,"商品预售活动和普通活动,非交易隔离，活动未开始，低优先级活动露出");
        try {
            //活动未开始
            AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
            activityStockBean.setActivityType(2);
            activityStockBean.getFBXCatalogLockList().forEach(p->{
                p.setEarnest(10);
                p.setAction(1);
                p.setEarnestDedution(15);
            });
            ProdStockCallService.AuditProductActivityStock(activityStockBean);

            //平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
            YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
            Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
            //更新活动更新活动商品状态（预售活动）
            ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);
            new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",false));

            String lowPrice = "9.0";
            Date beginTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600));
            Date endTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(7200));
            //报名低优先级活动
            ApplyActivityDto activityDto = priceCallService.ApplyLowActivity(lowPrice,activityStockBean.getProductID(),beginTime,endTime);

            getProductInfoByProductIdCall.callAndGetReturnData(activityStockBean.getProductID());
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            Logger.verifyEquals(null,product.getProductActivity(),"验证当前活动为空");

            //验证下一场活动是低优先级活动
            Logger.verifyEquals(activityDto.getActivityId(),product.getNextActivity().getActivityId(),"验证活动id是低优先级活动id");
        }catch(Exception e){
            Logger.fail(e);
        }
    }



    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_014() {
        Logger.start(true,"商品预售活动,交易隔离，活动已经开始，露出预售活动");
        try {
            //活动未开始
            AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
            String BeginTime = YMTDateUtil.getBeforeOrNextHour(-1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setBeginTime(BeginTime);
            String EndTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setEndTime(EndTime);
            activityStockBean.setActivityType(2);
            activityStockBean.getFBXCatalogLockList().forEach(p->{
                p.setEarnest(10);
                p.setAction(1);
                p.setEarnestDedution(15);
            });
            ProdStockCallService.AuditProductActivityStock(activityStockBean);

            //平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
            YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
            Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
            //更新活动更新活动商品状态（预售活动）
            ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);

            new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",true));

            checkByProductId(activityStockBean.getProductID(),activityStockBean.getProductActivityId(),0,0,true);

        }catch(Exception e){
            Logger.fail(e);
        }
    }

    /**
     * 如果商品是活动商品，活动审核通过，但是商品申请活动时提示“商品不存在” 检查下是否是商品服务差不多商品，商品申请活动调用的是GetProductDetailListByTradeIsolation接口
     * http://productquery.iapi.ymatou.com/api/Product/GetProductDetailListByTradeIsolation
     * {
     *     "ProductIdList":["p5375229"],
     *     "AppId":"evtadmin.ymatou.cn",
     *     "NextActivityExpire":17,
     *     "IgnoreActivityConf":true
     * }
     */
    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_012() {
        Logger.start(true,"商品预售活动,非交易隔离，活动已经开始，露出预售活动");
        try {
            //活动开始
            AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
            String BeginTime = YMTDateUtil.getBeforeOrNextHour(-1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setBeginTime(BeginTime);
            String EndTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setEndTime(EndTime);
            activityStockBean.setActivityType(2);
            activityStockBean.getFBXCatalogLockList().forEach(p->{
                p.setEarnest(10);
                p.setAction(1);
                p.setEarnestDedution(15);
            });
            ProdStockCallService.AuditProductActivityStock(activityStockBean);

            //平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
            YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
            Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
            //更新活动更新活动商品状态（预售活动）
            ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);

            new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",false));

            //add by wuwen 20210119
            //ProductManagerCallServiceV3.productMongocrudSync(activityStockBean.getProductID(),"SyncActivityProduct",activityStockBean.getProductActivityId());
            Thread.sleep(3000);
            checkByProductId(activityStockBean.getProductID(),activityStockBean.getProductActivityId(),0,0,false);

        }catch(Exception e){
            Logger.fail(e);
        }
    }



    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_013() {
        Logger.start(true,"商品预售活动,普通活动,非交易隔离，活动都已经开始,露出预售活动");
        try {
            //活动未开始
            AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
            String BeginTime = YMTDateUtil.getBeforeOrNextHour(-1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setBeginTime(BeginTime);
            String EndTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setEndTime(EndTime);
            activityStockBean.setActivityType(2);
            activityStockBean.getFBXCatalogLockList().forEach(p->{
                p.setEarnest(10);
                p.setAction(1);
                p.setEarnestDedution(15);
            });
            ProdStockCallService.AuditProductActivityStock(activityStockBean);

            //平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
            YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
            Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
            //更新活动更新活动商品状态（预售活动）
            ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);

            new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",false));

            String lowPrice = "9.0";
            Date beginTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(7200));
            //报名低优先级活动
            ApplyActivityDto activityDto = priceCallService.ApplyLowActivity(lowPrice,activityStockBean.getProductID(),beginTime,endTime);

            Thread.sleep(2000);
            //露出预售活动
            checkByProductId(activityStockBean.getProductID(),activityStockBean.getProductActivityId(),0,0,false);

        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_015() {
        Logger.start(true,"商品预售活动,普通活动,交易隔离，活动都已经开始,露出预售活动");
        try {
            //活动未开始
            AuditProductActivityStockBean activityStockBean = ProdStockCallService.initAuditProductActivityStockBean(sellerId);
            String BeginTime = YMTDateUtil.getBeforeOrNextHour(-1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setBeginTime(BeginTime);
            String EndTime = YMTDateUtil.getBeforeOrNextHour(1, YMTDateUtil.YMDTHMS_STRING);
            activityStockBean.setEndTime(EndTime);
            activityStockBean.setActivityType(2);
            activityStockBean.getFBXCatalogLockList().forEach(p->{
                p.setEarnest(10);
                p.setAction(1);
                p.setEarnestDedution(15);
            });
            ProdStockCallService.AuditProductActivityStock(activityStockBean);

            //平台预售活动扣除规格库存后活动商品暂时不同步到MongoDB，等待买手缴纳保证金
            YmtProductActivityStock productActivityStock = new YmtProductActivityStockWapper().selectByProductId(activityStockBean.getProductID()).get(0);
            Logger.verifyEquals(1,productActivityStock.getiAction(),"验证action为1");
            //更新活动更新活动商品状态（预售活动）
            ProdStockCallService.UpdateProductActivityStockAction(activityStockBean);

            new ActivityProductsWapper().update(activityStockBean.getProductID(), MapUtil.hashMap("isolation",true));

            String lowPrice = "9.0";
            Date beginTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600));
            Date endTime = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(7200));
            //报名低优先级活动
            ApplyActivityDto activityDto = priceCallService.ApplyLowActivity(lowPrice,activityStockBean.getProductID(),beginTime,endTime);

            //露出预售活动
            checkByProductId(activityStockBean.getProductID(),activityStockBean.getProductActivityId(),0,0,true);

        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_016() {
        Logger.start(true,"拼团商品查询商品详情,非交易隔离");
        try {
            AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            setStock(addpro, 30);
            setPrice(addpro, 100d);
            String pid = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            Double groupPrice = 50d;
            SaveGrouponBean saveGrouponBean = ProductManagerCallServiceV3.initSaveGrouponBean(sellerId,pid,groupPrice);
            ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
            checkByProductId(pid,0,0,0,false);
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_017() {
        Logger.start(true,"拼团商品查询商品详情,交易隔离");
        try {
            AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            setStock(addpro, 30);
            setPrice(addpro, 100d);
            String pid = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            Double groupPrice = 50d;
            SaveGrouponBean saveGrouponBean = ProductManagerCallServiceV3.initSaveGrouponBean(sellerId,pid,groupPrice);
            ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
            checkByProductId(pid,0,0,0,true);
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_018() {
        Logger.start(true,"拼团商品查询商品详情,非交易隔离，编辑拼团，再次查询");
        try {
            AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            setStock(addpro, 30);
            setPrice(addpro, 100d);
            String pid = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            Double groupPrice = 50d;
            SaveGrouponBean saveGrouponBean = ProductManagerCallServiceV3.initSaveGrouponBean(sellerId,pid,groupPrice);
            ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
            checkByProductId(pid,0,0,0,false);
            //编辑拼团
            YmtProductsIWapper YmtProductsIWapper = new YmtProductsIWapper();
            List<GrouponProducts> gp = YmtProductsIWapper.selectGrouponProducts(pid, null, 0);
            saveGrouponBean.setGrouponProductId(gp.get(0).getGrouponProductId());
            saveGrouponBean.getGrouponCatalogs().get(0).setGrouponPrice(60d);
            saveGrouponBean.setOperateType(1);
            ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
            checkByProductId(pid,0,0,0,false);
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_019() {
        Logger.start(true,"拼团商品查询商品详情,交易隔离，编辑拼团，再次查询");
        try {
            AddSellerProductRequest addpro = ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            setStock(addpro, 30);
            setPrice(addpro, 100d);
            String pid = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            Double groupPrice = 50d;
            SaveGrouponBean saveGrouponBean = ProductManagerCallServiceV3.initSaveGrouponBean(sellerId,pid,groupPrice);
            ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
            checkByProductId(pid,0,0,0,false);
            //编辑拼团
            YmtProductsIWapper YmtProductsIWapper = new YmtProductsIWapper();
            List<GrouponProducts> gp = YmtProductsIWapper.selectGrouponProducts(pid, null, 0);
            saveGrouponBean.setGrouponProductId(gp.get(0).getGrouponProductId());
            saveGrouponBean.getGrouponCatalogs().get(0).setGrouponPrice(60d);
            saveGrouponBean.setOperateType(1);
            ProductManagerCallServiceV3.SaveGrouponCall(saveGrouponBean);
            checkByProductId(pid,0,0,0,true);
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_20() {
        Logger.start(true,"下一场活动，商品报名多个优先级活动，NextActivityExpire为10天，活动时间距离当前时间超过十天，不露出活动");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "9.0";
            String price2 = "8.0";
            Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(11));
            Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(12));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price2,productId,beginTime2,endTime2);
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime2,endTime2);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            Logger.verifyEquals(null,product.getProductActivity(),"验证商品当前活动为null");
            Logger.verifyEquals(null,product.getNextActivity(),"验证商品下一场活动为null");
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_21() {
        Logger.start(true,"下一场活动，商品报名多个优先级活动，NextActivityExpire为10天，活动时间距离当前时间超过十天，不露出活动");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "9.0";
            String price2 = "8.0";
            Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(11));
            Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(12));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price2,productId,beginTime2,endTime2);
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime2,endTime2);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            Logger.verifyEquals(null,product.getProductActivity(),"验证商品当前活动为null");
            Logger.verifyEquals(null,product.getNextActivity(),"验证商品下一场活动为null");
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_24() {
        Logger.start(true,"下一场活动，商品报名多个优先级活动，活动时间重合，NextActivityExpire为10天，活动都拥有大促配置，下一场活动露出高优先级活动");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "9.0";
            String price2 = "8.0";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(1));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
            Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(1));
            Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price2,productId,beginTime1,endTime1);
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime2,endTime2);

            List<Integer> activitys = new ArrayList<>();
            activitys.add(applyActivityDto1.getActivityId());
            activitys.add(applyActivityDto2.getActivityId());
            ProductQueryCallService.updateActivityConfig(activitys);
            YMTDateUtil.waitTime(10);
            getProductInfoByProductIdCall.callAndGetReturnData(productId);

            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            checkByProductId(productId,0,product.getNextActivity().getProductInActivityId(),0,false);
            Logger.verifyEquals(applyActivityDto1.getActivityId(),product.getNextActivity().getActivityId(),"验证活动是高优先级活动");
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    @Ignore//手动校验
    public void Tc_GetProductInfoByProductId_22() {
        Logger.start(true,"下一场活动，商品报名多个优先级活动，活动时间重合，NextActivityExpire为10天，活动都拥有大促配置，高优先级活动开始时间超过大促配置的露出时间，下一场活动露出低优先级活动");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "9.0";
            String price2 = "8.0";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(5));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(6));
            Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
            Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(6));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price2,productId,beginTime1,endTime1);
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime2,endTime2);

            List<Integer> activitys = new ArrayList<>();
            activitys.add(applyActivityDto1.getActivityId());
            activitys.add(applyActivityDto2.getActivityId());
            ProductQueryCallService.updateActivityConfig(activitys);
            YMTDateUtil.waitTime(10);
            ProductInDetailBean product = null;

            getProductInfoByProductIdCall.callAndGetReturnData(productId);
            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);

            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            checkByProductId(productId,0,Integer.parseInt(applyActivityDto2.getAids().get(0)),0,false);
            Logger.verifyEquals(applyActivityDto2.getActivityId(),product.getNextActivity().getActivityId(),"验证下一场活动是低优先级活动");
        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    @Ignore//手动校验
    public void Tc_GetProductInfoByProductId_23() {
        Logger.start(true,"下一场活动，商品报名多个优先级活动，活动时间重合，NextActivityExpire为10天，活动都拥有大促配置，高优先级活动和低优先级活动的开始时间都超过大促配置的露出时间，下一场活动不露出");
        try {
            AddSellerProductRequest addpro =  ProductManagerCallServiceV2.initAddSellerProductRequest(sellerId);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addpro);
            String price1 = "9.0";
            String price2 = "8.0";
            Date beginTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(1));
            Date endTime1 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
            Date beginTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(1));
            Date endTime2 = YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextDay(2));
            ApplyActivityDto applyActivityDto1 = priceCallService.ApplyHighActivity(price2,productId,beginTime1,endTime1);
            ApplyActivityDto applyActivityDto2 = priceCallService.ApplyLowActivity(price1,productId,beginTime2,endTime2);

            List<Integer> activitys = new ArrayList<>();
            activitys.add(applyActivityDto1.getActivityId());
            activitys.add(applyActivityDto2.getActivityId());
            ProductQueryCallService.updateActivityConfigV2(activitys);
            ProductInDetailBean product = null;
            getProductInfoByProductIdCall.callAndGetReturnData(productId);
            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
            product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            checkByProductId(productId,0,0,0,false);
        }catch(Exception e){
            Logger.fail(e);
        }
    }



    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_37() {
        Logger.start(true,"商品拼邮海外发货");
        try {
            AddSellerProductRequest addSellerProductRequest = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
            addSellerProductRequest.getProduct().setPackageDeliveryType(1);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addSellerProductRequest);

            getProductInfoByProductIdCall.callAndGetReturnData(productId);
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            checkByProductId(productId,0,0,0,false);

        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    public void Tc_GetProductInfoByProductId_38() {
        Logger.start(true,"商品拼邮国内发货");
        try {
            AddSellerProductRequest addSellerProductRequest = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
            addSellerProductRequest.getProduct().setPackageDeliveryType(2);
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addSellerProductRequest);

            getProductInfoByProductIdCall.callAndGetReturnData(productId);
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            checkByProductId(productId,0,0,0,false);

        }catch(Exception e){
            Logger.fail(e);
        }
    }

    @Test
    @Category({P1.class})
    @TestCase
    @Ignore
    public void Tc_GetProductInfoByProductId_39() {
        Logger.start(true,"直播买手快速发布商品，查询失败（与Tc_GetNewProductListBySellerIdList_003问题一致）");
        try {
            AddSellerProductRequest addProdReq = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
            LiveRoom createlive = LiveRoomCallService.CreateSellerLive(LiveRoomCallService.initCreatesellerliveBean(sellerId));
            addProdReq.getProduct().setLiveRoomId(createlive.getId());
            LiveRoomCallService.UpdateLiveTimeToStart(createlive.getId());
            LiveRoomCallService.SellerLiveOnline(createlive.getId(), createlive.getUserId());
            String productId = ProductManagerCallServiceV3.AddSellerProduct(addProdReq);

            getProductInfoByProductIdCall.callAndGetReturnData(productId);
            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
            Logger.verifyEquals(true,getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").isJsonNull(),"验证查询结果为空");
        }catch(Exception e){
            Logger.fail(e);
        }
    }


		///////////////////////////// 忽略case //////////////////////

//    @Test
//    @Category({P1.class})
//    @TestCase
//    @Ignore
//    public void Tc_GetProductInfoByProductId_25() {
//        Logger.start(true,"渠道商获取自采神器商品");
//        try {
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,rootUserName,false);
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//            getProductInfoByProductIdCall.callAndGetReturnData(productId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(productId,false);
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//
//    @Test
//    @Category({P1.class})
//    @TestCase
//    @Ignore
//    public void Tc_GetProductInfoByProductId_26() {
//        Logger.start(true,"渠道商获取自采神器保存商品");
//        try {
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,rootUserName,false);
//            addAgentProductBean.setSaleType(2);
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//            getProductInfoByProductIdCall.callAndGetReturnData(productId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(productId,false);
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//
//    @Test
//    @Category({P1.class})
//    @TestCase
//    @Ignore
//    public void Tc_GetProductInfoByProductId_27() {
//        Logger.start(true,"普通代理商获取商品详情");
//        try {
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,rootUserName,true);
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//            ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,rootUserId,false);
//            String agentProductId =  AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
//            Thread.sleep(2000);
//            getProductInfoByProductIdCall.callAndGetReturnData(productId);
//            getProductInfoByProductIdCall.callAndGetReturnData(agentProductId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(agentProductId,false);
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//
//    @Test
//    @Category({P1.class})
//    @TestCase
//    @Ignore
//    public void Tc_GetProductInfoByProductId_32() {
//        Logger.start(true,"vip渠道->vip1->vip2,获取vip2商品详情");
//        try {
//            AddAgentProductBean agentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
//            String productId = AddAgentProductCallService.AddAgentProduct(agentProductBean);
//
//            ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
//            String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
//
//            ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId2,vipAgentUserName2,agentProductId,vipAgentUserId1,false);
//            String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);
//            Thread.sleep(10000);
//
//            getProductInfoByProductIdCall.callAndGetReturnData(agentProductId1);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(agentProductId1,false);
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//
//    @Test
//    @Category({P1.class})
//    @TestCase
//    @Ignore
//    public void Tc_GetProductInfoByProductId_28() {
//        Logger.start(true,"vip渠道商删除商品，查询各级代理商商品信息");
//        try {
//            //mongo同步慢  商品删除 mongo库数据也删除
//            AddAgentProductBean agentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
//            String productId = AddAgentProductCallService.AddAgentProduct(agentProductBean);
//
//            ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
//            String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
//
//            ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId2,vipAgentUserName2,agentProductId,vipAgentUserId1,false);
//            String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);
//
//            AddAgentProductCallService.DeleteProduct(productId,vipRootUserId);
//            Thread.sleep(3000);
//            getProductInfoByProductIdCall.callAndGetReturnData(productId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(productId,false);            Thread.sleep(3000);
//            getProductInfoByProductIdCall.callAndGetReturnData(agentProductId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(agentProductId,false);
//            getProductInfoByProductIdCall.callAndGetReturnData(agentProductId1);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(agentProductId1,false);
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//
//    @Test
//    @Category({P1.class})
//    @TestCase
//    @Ignore
//    public void Tc_GetProductInfoByProductId_29() {
//        Logger.start(true,"vip渠道->vip1->vip2,渠道商下架商品，获取vip1和VIP2代理商品");
//        try {
//            AddAgentProductBean agentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
//            String productId = AddAgentProductCallService.AddAgentProduct(agentProductBean);
//
//            ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1,vipAgentUserName1,productId,vipRootUserId,true);
//            String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
//
//            ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId2,vipAgentUserName2,agentProductId,vipAgentUserId1,false);
//            String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);
//            //商品下架
//            AddAgentProductCallService.SetOffshelf(productId,vipRootUserId);
//            Thread.sleep(2000);
//            getProductInfoByProductIdCall.callAndGetReturnData(productId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            getProductInfoByProductIdCall.callAndGetReturnData(agentProductId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(agentProductId,false);
//            getProductInfoByProductIdCall.callAndGetReturnData(agentProductId1);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(agentProductId1,false);
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//
//    @Test
//    @Category({P1.class})
//    @TestCase
//    @Ignore
//    public void Tc_GetProductInfoByProductId_30() {
//        Logger.start(true,"普通渠道修改代理价（修改后≥下级代理的销售价），获取vip1和VIP2的商品详情");
//        try {
//            //渠道商
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,rootUserName,true);
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//
//            //普通代理商
//            ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1,agentUserName1,productId,rootUserId,false);
//            String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
//
//            //编辑
//            ModifyAgentProductBean modifyagentproductBean = AddAgentProductCallService.initModifyAgentProductBean(productId,addAgentProductBean);
//            //修改规格的代理价
//            String catalogId = modifyagentproductBean.getCatalogList().get(0).getCatalogId();
//            modifyagentproductBean.getCatalogList().get(0).getAgentPriceList().forEach(p->{
//                p.setAgentPrice(500);
//            });
//            AddAgentProductCallService.modifyAgentProduct(modifyagentproductBean);
//
//            getProductInfoByProductIdCall.callAndGetReturnData(agentProductId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(agentProductId,false);
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//
//
//    @Test
//    @Category({P1.class})
//    @TestCase
//    @Ignore
//    public void Tc_GetProductInfoByProductId_33() {
//        Logger.start(true,"获取自采商品运费模板信息");
//        try {
//            createmchBean createmchBean = GodmchManageCallService.InitcreatemchBeanForChannel();
//            GodmchManageCallService.createmchCallForChannel(createmchBean);
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(createmchBean.getMchId(),createmchBean.getNickName(),false);
//            CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService.initCreateFreightTemplate(createmchBean.getMchId(), 1, 2);
//            String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);
//            addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//
//            getProductInfoByProductIdCall.callAndGetReturnData(productId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(productId,false);
//            freight_templateWapper templateWapper = new freight_templateWapper();
//            templateWapper.updateStatusByKey(Integer.parseInt(templateId));
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//
//    @Test
//    @Category({P1.class})
//    @TestCase
//    @Ignore
//    public void Tc_GetProductInfoByProductId_34() {
//        Logger.start(true,"获取代理商品运费模板信息");
//        try {
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,rootUserName,true);
//            CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService.initCreateFreightTemplate(rootUserId, 1, 2);
//            String templateId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);
//            addAgentProductBean.setFreightTemplateId(Integer.parseInt(templateId));
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//
//            ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1, agentUserName1, productId, rootUserId, false);
//            String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
//
//            getProductInfoByProductIdCall.callAndGetReturnData(agentProductId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(productId,false);
//
//            freight_templateWapper templateWapper = new freight_templateWapper();
//            templateWapper.updateStatusByKey(Integer.parseInt(templateId));
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//
//    @Test
//    @Category({P1.class})
//    @TestCase
//    @Ignore
//    public void Tc_GetProductInfoByProductId_35() {
//        Logger.start(true,"渠道商商品币种信息校验");
//        try {
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,rootUserName,true);
//
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//
//            ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1, agentUserName1, productId, rootUserId, false);
//            String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
//
//            getProductInfoByProductIdCall.callAndGetReturnData(agentProductId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(productId,false);
//
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//
//    @Test
//    @Category({P1.class})
//    @TestCase
//    @Ignore
//    public void Tc_GetProductInfoByProductId_36() {
//        Logger.start(true,"代理商商品币种信息校验");
//        try {
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,rootUserName,true);
//
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//
//            ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(agentUserId1, agentUserName1, productId, rootUserId, false);
//            String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
//
//            getProductInfoByProductIdCall.callAndGetReturnData(agentProductId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            checkByProductIdV2(productId,false);
//
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }

//    @Test
//    @Category({P2.class})
//    @TestCase
//    public void Tc_GetProductInfoByProductId_40() {
//        Logger.start(true,"神器商品，库存为0，查询失败");
//        try {
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,rootUserName,true);
//            addAgentProductBean.getCatalogList().forEach(p->{
//                p.setStock(0);
//            });
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//
//            getProductInfoByProductIdCall.callAndGetReturnData(productId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            Logger.verifyEquals(true,getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").isJsonNull(),"验证查询结果为空");
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//    @Test
//    @Category({P2.class})
//    @TestCase
//    public void Tc_GetProductInfoByProductId_41() {
//        Logger.start(true,"全球优选商品查询-新增字段MemberProduct");
//        try {
//            Integer seller2=20336378;
//            AddSellerProductRequest addProdReq = ProductManagerCallServiceV2.initAddSellerGlobalPspProductRequest(seller2);
//            String productId = ProductManagerCallServiceV2.addNewProduct(addProdReq).get("Data").getAsJsonObject().get("ProductId").getAsString();
//            Thread.sleep(5000);
//            getProductInfoByProductIdCall.callAndGetReturnData(productId);
//            while(getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").isJsonNull()) {
//                Thread.sleep(3000);
//                getProductInfoByProductIdCall.callAndGetReturnData(productId);
//            }
//            ProductManagerCallServiceV3.SetMemberProduct(productId, seller2, true);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//            boolean bMemberProduct=getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().get("MemberProduct").getAsBoolean();
//            if(!bMemberProduct) {
//                Thread.sleep(3000);
//                getProductInfoByProductIdCall.callAndGetReturnData(productId);
//                bMemberProduct=getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().get("MemberProduct").getAsBoolean();
//            }
//            Logger.verifyEquals(true, bMemberProduct, "验证bMemberProduct");
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//
//
//    //免税店
//    private static int userId=AgentUsers.vipRootUserId;
//    private static String userName="韩国免税店";
//    @Test
//    @Category({P2.class})
//    @TestCase
//    public void Tc_GetProductInfoByProductId_42() {
//        Logger.start(true,"韩国免税店，不包税，限购，查询成功");
//        try {
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProductV3(userId,userName,true);
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//            //跳过总线
//            ProductManagerCallServiceV3.productMongocrudSync(productId,"CreateProduct",0);
//            getProductInfoByProductIdCall.callAndGetReturnData(productId);
//            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//        }catch(Exception e){
//            Logger.fail(e);
//        }
//    }
//
//
//    @Test
//    @Category({P1.class})
//    @TestCase
//    public void Tc_GetProductInfoByProductId_43() {
//        Logger.start(true,"代购神器商品，下级商品的sku取货头商品规格的sku值");
//        try {
//            //创建运费模板
//            CreateFreightTemplateBean createFreightTemplateBean = GodfreightmgrService.initCreateFreightTemplate(vipRootUserId, 1, 2);
//            String telId = GodfreightmgrService.CreateFreightTemplate(createFreightTemplateBean);
//            //渠道商新建商品
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
//            addAgentProductBean.setFreightTemplateId(Integer.parseInt(telId));
//            int rootsku1=Integer.parseInt(addAgentProductBean.getCatalogList().get(0).getSku());
//            int rootsku2=Integer.parseInt(addAgentProductBean.getCatalogList().get(1).getSku());
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//
//            //vip1代理渠道商
//            ImportAgentProductBean importAgentProductBean = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId1, vipAgentUserName1, productId, vipRootUserId, true);
//            String agentProductId = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean);
//            //VIP2代理vip1
//            ImportAgentProductBean importAgentProductBean1 = AddAgentProductCallService.initImportAgentProduct(vipAgentUserId2, vipAgentUserName2, agentProductId, vipAgentUserId1, false);
//            String agentProductId1 = AddAgentProductCallService.ImportAgentProduct(importAgentProductBean1);
//
//            //修改渠道商的sku，查询渠道商
//            ModifyAgentProductBean mpb=AddAgentProductCallService.initModifyAgentProductBean(productId, addAgentProductBean);
//            rootsku1=777777;
//            rootsku2=777777;
//            mpb.getCatalogList().get(0).setSku(""+rootsku1);
//            mpb.getCatalogList().get(1).setSku(""+rootsku2);
//            AddAgentProductCallService.modifyAgentProduct(mpb);
//            ProductManagerCallServiceV3.productMongocrudSync(productId, "CreateProduct",0);
//            getProductInfoByProductIdCall.callAndGetReturnData(productId);
//            Logger.verifyEquals("200", getProductInfoByProductIdCall.getString("Code"), "验证code");
//            int sku1=getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().getAsJsonArray("CatalogList").get(0).getAsJsonObject().get("SKU").getAsInt();
//            int sku2=getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().getAsJsonArray("CatalogList").get(1).getAsJsonObject().get("SKU").getAsInt();
//            Logger.verifyEquals(rootsku1,sku1,"验证渠道商sku是否被修改");
//            Logger.verifyEquals(rootsku2,sku2,"验证渠道商sku是否被修改");
//
//            //查询vip1
//            ProductManagerCallServiceV3.productMongocrudSync(agentProductId, "CreateProduct",0);
//            getProductInfoByProductIdCall.callAndGetReturnData(agentProductId);
//            Logger.verifyEquals("200", getProductInfoByProductIdCall.getString("Code"), "验证code");
//            sku1=getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().getAsJsonArray("CatalogList").get(0).getAsJsonObject().get("SKU").getAsInt();
//            sku2=getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().getAsJsonArray("CatalogList").get(1).getAsJsonObject().get("SKU").getAsInt();
//            Logger.verifyEquals(rootsku1,sku1,"验证vip1sku1是否被修改");
//            Logger.verifyEquals(rootsku2,sku2,"验证vip1sku2是否被修改");
//
//            //查询vip2
//            ProductManagerCallServiceV3.productMongocrudSync(agentProductId1, "CreateProduct",0);
//            getProductInfoByProductIdCall.callAndGetReturnData(agentProductId1);
//            Logger.verifyEquals("200", getProductInfoByProductIdCall.getString("Code"), "验证code");
//            sku1=getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().getAsJsonArray("CatalogList").get(0).getAsJsonObject().get("SKU").getAsInt();
//            sku2=getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().getAsJsonArray("CatalogList").get(1).getAsJsonObject().get("SKU").getAsInt();
//            Logger.verifyEquals(rootsku1,sku1,"验证vip2sku1是否被修改");
//            Logger.verifyEquals(rootsku2,sku2,"验证vip2sku2是否被修改");
//
//
//        } catch (Exception e) {
//            Logger.fail(e);
//        }
//    }
//
//
//    @Test
//    @Category({P1.class})
//    @TestCase
//    public void Tc_GetProductInfoByProductId_44() {
//        Logger.start(true, "神器折扣活动查询");
//        try {
//
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(vipRootUserId,vipRootUserName,true);
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//
//            JSONObject callAndGetReturnData = getProductInfoByProductIdCall.callAndGetReturnData("p2418979");
//            System.out.println(callAndGetReturnData);
//
//
//
////            userId = AgentUsers.vipRootUserId;
////            GetProductListBean getproductlistBean = AddAgentProductCallService.initGetProductListBean(userId);
//////			getproductlistBean.setTitle(addAgentProductBean.getTitle());
//////			getproductlistBean.setAgentType(-1);
////			GetProductListCall getproductlistCall = new GetProductListCall();
////			getproductlistCall.setData(getproductlistBean);
////			getproductlistCall.callService();
////			Logger.verifyEquals("200", getproductlistCall.getString("code"), "验证code");
////			List<ProductListDto> productListDtoList = getproductlistCall.getProductList();
////			System.out.println(productListDtoList);
////
//            //获取规格ID
////	            List<String> catalogs = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).stream().map(YmtCatalogsI::getsCatalogId).collect(Collectors.toList());
////	            //创建一个高优先级活动  得到活动id
////	            Integer activityId = ProductManagerCallServiceV2.createGodDiscount();
////	            //报名活动  获得商品在活动中的id
////	            String price1 = "8.0";
////	            Integer activityStockNum = 100;
////	            System.out.println("==========="+catalogs.toString());
////	            List<String> aids = ProductManagerCallServiceV2.ApplyActivity(productId, sellerId,catalogs,activityId, activityStockNum,price1);
////	            //审核通过
////	            ProductManagerCallServiceV2.approveProductInActivityV2(productId,aids.get(0),true);
////	            new ProductsWapperV2().updateActivityProductByProductId(MapUtil.hashMap("aid",activityId),MapUtil.hashMap("start",
////	                    YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(-3600)),"end",YMTDateUtil.parseYMDHMSDate(YMTDateUtil.getBeforeOrNextSecond(3600)),"discount","2","atype","3"));
////	            //更新商品时间戳
////	            productTimeStampWapper.update(productId, MapUtil.hashMap("aut",new Date(),"cut",new Date()));
////	            getProductInfoByProductIdCall.callAndGetReturnData(productId);
////
////	            String ret = getProductInfoByProductIdCall.getJsonObject().get("Data").getAsJsonObject().get("Product").getAsJsonObject().toString();
////	            ProductInDetailBean product =(ProductInDetailBean) FormatUtil.GSONToObject(ret, ProductInDetailBean.class);
////	            List<CatalogInDetailBean> cataloglist = product.getCatalogList();
////	            Logger.verifyEquals("200",getProductInfoByProductIdCall.getString("Code"),"验证Code");
//
//
//        }catch (Exception e) {
//            Logger.fail(e);
//        }
//
//    }
//
//
//    @Test
//    @Category(P1.class)
//    @TestCase
//    public void Tc_GetProductInfoByProductId_45() {
//        Logger.start(true, "查询限时抢八折后价格");
//        try {
//            AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
//                    rootUserName, false);
//            double price = 123.6;
//            addAgentProductBean.getCatalogList().forEach(a -> {
//                a.getAgentPriceList().forEach(b -> {
//                    b.setAgentPrice(price);
//                });
//                a.setDirectPrice(price);
//            });
//            String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
//            // 创建限时抢购活动
//            List<String> catalogList = new ArrayList<String>();
//            ProductDetailsDto selectProductDetails = AddAgentProductCallService.selectProductDetails(rootUserId,
//                    productId);
//            selectProductDetails.getCatalogList().forEach(a -> {
//                catalogList.add(a.getCatalogId());
//            });
//            List<String> catalogs = new ArrayList<String>();
//
//            AddactivityBean initProductaddactivity = AgentProductCallService.initProductaddactivity(rootUserId,
//                    productId, catalogList);
//            initProductaddactivity.getProductList().forEach(a -> {
//                a.getCatalogList().forEach(b -> {
//                    catalogs.add(b.getCatalogId());
//                    b.setDiscount(new BigDecimal("8"));
//                });
//            });
//            int activityId = AgentProductCallService.agentProductaddactivity(initProductaddactivity);
//            Thread.sleep(4000);
//            JSONObject callAndGetReturnData = getProductInfoByProductIdCall.callAndGetReturnData(productId);
//            JSONObject asJsonObject1 = callAndGetReturnData.getJSONObject("Data").getJSONObject("Product").getJSONArray("CatalogList").getJSONObject(0);
//            JSONObject asJsonObject2 = callAndGetReturnData.getJSONObject("Data").getJSONObject("Product").getJSONArray("CatalogList").getJSONObject(1);
//            Logger.verifyEquals(price, asJsonObject1.getDouble("Price"), "验证是否为八折价格");
//            Logger.verifyEquals(price, asJsonObject2.getDouble("Price"), "验证是否为八折价格");
//            Logger.verifyEquals(price * 0.8, asJsonObject2.getDouble("ActivityPrice"), "验证是否为八折价格");
//            Logger.verifyEquals(price * 0.8, asJsonObject2.getDouble("ActivityPrice"), "验证是否为八折价格");
//
//        } catch (Exception e) {
//            Logger.fail(e);
//        }
//    }



    public void checkByProductId(String prod,int prodInActivityId,int prodInNextActivityId,int liveId,boolean isTradeIsolation) throws Exception{
        YMTDateUtil.waitTime(2);
        List<String> prodList = Arrays.asList(prod);
        ProductInDetailBean tgtProdInDetailBean = ProductQueryCallService.getProductInDetailBean(prod, prodInActivityId, prodInNextActivityId, liveId);

        JSONObject ret;
        String chkdesc;
        if (isTradeIsolation){
            //交易隔离接口
            ret = getProductInfoByTradeIsolationCall.search(prodList);
            chkdesc = "检查 GetProductDetailListByTradeIsolation,  productId:"+prod;
        }else{
            //普通交易不隔离接口
            ret = getProductInfoByProductIdCall.search(prodList);
            chkdesc = "检查 GetProductDetailListByProductIdList, productId:"+prod;
        }
        //返回码检查
        Logger.verifyEquals(200, ret.getInt("Code"), "返回码检查");

        //返回值取数据
        ProductInDetailBean actProdInDetailBean = ProductQueryCallService.getBeanFromJson(ret.getJSONObject("Data").getJSONObject("Product"),ProductInDetailBean.class);
        //比对
        ProductQueryCallService.compareProductInDetailBean(prodList, Arrays.asList(tgtProdInDetailBean), Arrays.asList(actProdInDetailBean),chkdesc);
    }

    public void checkByProductIdV2(String prod,boolean isTradeIsolation) throws Exception{
        YMTDateUtil.waitTime(5);
        List<String> prodList = Arrays.asList(prod);
        JSONObject ret;
        String chkdesc;
        if (isTradeIsolation){
            //交易隔离接口
            ret = getProductInfoByTradeIsolationCall.search(prodList);
            chkdesc = "检查 GetProductDetailListByTradeIsolation,  productId:"+prod;
        }else{
            //普通交易不隔离接口
            ret = getProductInfoByProductIdCall.search(prodList);
            chkdesc = "检查 GetProductDetailListByProductIdList, productId:"+prod;
        }
        //返回码检查
        Logger.verifyEquals(200, ret.getInt("Code"), "返回码检查");
        ProductInDetailBean tgtProdInDetailBean = ProductQueryCallService.getProductInDetailBean(prod);
        Logger.debug("tgtProdInDetailBean:"+tgtProdInDetailBean);
        //返回值取数据
        ProductInDetailBean actProdInDetailBean = ProductQueryCallService.getBeanFromJson(ret.getJSONObject("Data").getJSONObject("Product"),ProductInDetailBean.class);
        //比对
        ProductQueryCallService.compareProductInDetailBean(prodList, Arrays.asList(tgtProdInDetailBean), Arrays.asList(actProdInDetailBean),chkdesc);
    }

    private void setStock(AddSellerProductRequest addpro, Integer catalogNum) {
        addpro.getProduct().getCatalogList().forEach(catalog -> {
            catalog.setStock(catalogNum);
        });
    }

    private void setPrice(AddSellerProductRequest addpro, Double price) {
        addpro.getProduct().getCatalogList().forEach(catalog -> {
            catalog.setNewPrice(price);
            catalog.setMarketPrice(price);
            catalog.setVipPrice(price);
            catalog.setPrice(price);
        });
    }


}
